<script>
  // 全局的枚举
  exports.install = function(Vue, options) {
    // 供应商相关
    Vue.prototype.$organizationTypeOptions = [{ label: '个人', key: 'GEREN' }, { label: '出版社', key: 'CHUBANSHE' }, { label: '出版公司', key: 'CHUBANGS' }, { label: '文化公司', key: 'WENHUAGS' }, { label: '平台', key: 'PINGTAI' }]
    Vue.filter('$organizationTypeFilter', function(organizationType) {
      const organizationTypeMap = {
        GEREN: '个人',
        CHUBANSHE: '出版社',
        CHUBANGS: '出版公司',
        WENHUAGS: '文化公司',
        PINGTAI: '平台'
      }
      return organizationTypeMap[organizationType]
    })

    Vue.prototype.$supplyTypeOptions = [{ label: '综合供应商', key: '1' }, { label: '绘本供应商', key: '2' }, { label: '听书供应商', key: '3' }, { label: 'IP供应商', key: '4' }]
    Vue.filter('$supplyTypeFilter', function(supplyType) {
      const supplyTypeMap = {
        1: '综合供应商',
        2: '绘本供应商',
        3: '听书供应商',
        4: 'IP供应商'
      }
      return supplyTypeMap[supplyType]
    })

    Vue.prototype.$supplyLevelOptions = [{ label: 'A级', key: 'A' }, { label: 'B级', key: 'B' }, { label: 'C级', key: 'C' }, { label: '默认', key: 'DEFAULT' }]
    Vue.filter('$supplyLevelFilter', function(supplyLevel) {
      const supplyLevelMap = {
        A: 'A级',
        B: 'B级',
        C: 'C级',
        DEFAULT: '默认'
      }
      return supplyLevelMap[supplyLevel]
    })

    Vue.prototype.$supplyStatusOptions = [{ label: '已上线', key: '1' }, { label: '已下线', key: '2' }, { label: '已提供内容', key: '3' }, { label: '已签约', key: '4' }, { label: '确认意向', key: '5' }, { label: '联系上', key: '6' }, { label: '已搁置', key: '7' }, { label: '合作结束', key: '8' }, { label: '待联系', key: '9' }]
    Vue.filter('$supplyStatusFilter', function(status) {
      const statusMap = {
        1: '已上线',
        2: '已下线',
        3: '已提供内容',
        4: '已签约',
        5: '确认意向',
        6: '联系上',
        7: '已搁置',
        8: '合作结束',
        9: '待联系'
      }
      return statusMap[status]
    })

    // 合同相关
    Vue.prototype.$expireOptions = [{ label: '已到期', key: '0' }, { label: '1个月内到期', key: '1' }, { label: '3个月内到期', key: '3' }, { label: '6个月内到期', key: '6' }, { label: '6个月以外到期', key: '7' }]
    Vue.filter('$expireStatusFilter', function(status) {
      const expireOptionsMap = {
        '0': '已到期',
        '1': '1个月内到期',
        '3': '3个月内到期',
        '6': '6个月内到期',
        '7': '6个月以外到期'
      }
      return expireOptionsMap[status]
    })

    Vue.prototype.$balanceTypeOptions = [{ label: '买断', key: 'BUY' }, { label: '预付加分成', key: 'PrePayDivide' }, { label: '无预付纯分成', key: 'DIVIDE' }]
    Vue.filter('$balanceTypeFilter', function(balanceType) {
      const balanceTypeMap = {
        BUY: '买断',
        PrePayDivide: '预付加分成',
        DIVIDE: '无预付纯分成'
      }
      return balanceTypeMap[balanceType]
    })

    Vue.prototype.$balanceTypeAllOptions = [{ label: '买断', key: 'BUY' }, { label: '预付加分成', key: 'PrePayDivide' }, { label: '无预付纯分成', key: 'DIVIDE' }, { label: '复合结算', key: 'MixClear' }]
    Vue.filter('$balanceTypeAllFilter', function(balanceType) {
      const balanceTypeAllMap = {
        BUY: '买断',
        PrePayDivide: '预付加分成',
        DIVIDE: '无预付纯分成',
        MixClear: '复合结算'
      }
      return balanceTypeAllMap[balanceType]
    })

    Vue.prototype.$statusOptions = [{ label: '已生效', key: 'VALID' }, { label: '已失效', key: 'INVALID' }]
    Vue.filter('$statusFilter', function(status) {
      const statusMap = {
        VALID: '已生效',
        INVALID: '已失效'
      }
      return statusMap[status]
    })

    Vue.prototype.$contractTypeOptions = [{ label: '版权引入', key: 'IN' }, { label: '版权输出', key: 'OUT' }]
    Vue.filter('$contractTypeFilter', function(type) {
      const typeMap = {
        IN: '版权引入',
        OUT: '版权输出'
      }
      return typeMap[type]
    })

    Vue.prototype.$contractNumOptions = [{ label: '两方', key: '2' }, { label: '三方', key: '3' }]
    Vue.filter('$partyFilter', function(party) {
      const partyMap = {
        2: '两方',
        3: '三方'
      }
      return partyMap[party]
    })

    // 版权相关
    Vue.prototype.$worksTypeOptions = [{ label: '绘本', key: 'WorksSingle' }, { label: '听书', key: 'ListeningCollection' }]
    Vue.filter('$worksTypeFilter', function(type) {
      const worksTypeMap = {
        WorksSingle: '绘本',
        ListeningCollection: '听书'
      }
      return worksTypeMap[type]
    })
    Vue.prototype.$tfOptions = [{ label: '有', key: 'T' }, { label: '无', key: 'F' }]
    Vue.filter('$tfFilter', function(value) {
      const tfMap = {
        T: '有',
        F: '无'
      }
      return tfMap[value]
    })
    Vue.prototype.$ynOptions = [{ label: '是', key: 'T' }, { label: '否', key: 'F' }]
    Vue.filter('$ynFilter', function(value) {
      const ynMap = {
        T: '是',
        F: '否'
      }
      return ynMap[value]
    })
    Vue.prototype.$provideOptions = [{ label: '已提供', key: 'T' }, { label: '未提供', key: 'F' }]
    Vue.filter('$provideFilter', function(value) {
      const provideMap = {
        T: '已提供',
        F: '未提供'
      }
      return provideMap[value]
    })

    Vue.prototype.$backgroundOptions = [{ label: '名著', key: 'FamousWorks' }, { label: '获奖作品', key: 'AwardsWorks' }, { label: '名家', key: 'FamousAuthor' }, { label: '获奖作者', key: 'AwardsAuthor' }]
    Vue.filter('$backgroundFilter', function(background) {
      const backgroundMap = {
        FamousWorks: '名著',
        AwardsWorks: '获奖作品',
        FamousAuthor: '名家',
        AwardsAuthor: '获奖作者'
      }
      return backgroundMap[background]
    })

    Vue.prototype.$copyrightClassOptions = [{ label: '表演权', key: 'PERFORM' }, { label: '信息网络传播权', key: 'InternetSpread' }, { label: '改编权', key: 'RECOMPOSE' }, { label: '转授权', key: 'SUBLICENSE' }, { label: '翻译权', key: 'TRANSLATION' }]
    Vue.filter('$copyrightClassFilter', function(copyrightClass) {
      const copyrightClassMap = {
        PERFORM: '表演权',
        InternetSpread: '信息网络传播权',
        RECOMPOSE: '改编权',
        SUBLICENSE: '转授权',
        TRANSLATION: '翻译权'
      }
      return copyrightClassMap[copyrightClass]
    })

    Vue.prototype.$copyrightsRangeOptions = [{ label: '海外', key: 'OVERSEAS' }, { label: '中国大陆', key: 'MAINLAND' }, { label: '港澳台', key: 'GAT' }]
    Vue.filter('$copyrightsRangeFilter', function(range) {
      const rangeMap = {
        OVERSEAS: '海外',
        MAINLAND: '中国大陆',
        GAT: '港澳台'
      }
      return rangeMap[range]
    })

    Vue.prototype.$usedPlatformOptions = [{ label: '乙方自有平台', key: 'TwoOwnPlatform' }, { label: '乙方关联平台', key: 'TwoLinkPlatform' }]
    Vue.filter('$usedPlatformFilter', function(value) {
      const usedPlatformMap = {
        TwoOwnPlatform: '乙方自有平台',
        TwoLinkPlatform: '乙方关联平台'
      }
      return usedPlatformMap[value]
    })

    Vue.prototype.$onlineStatusOptions = [{ label: '上线', key: 'ONLINE' }, { label: '下线', key: 'OFFLINE' }]
    Vue.filter('$onlineStatusFilter', function(value) {
      const onlineStatusMap = {
        ONLINE: '上线',
        OFFLINE: '下线'
      }
      return onlineStatusMap[value]
    })

    Vue.prototype.$traceStatusOptions = [{ label: '待追溯', key: 'WaitTrace' }, { label: '已追溯', key: 'TRACING' }, { label: '追溯中', key: 'TRACED' }, { label: '已拒绝', key: 'REFUSED' }]

    // 沟通交流相关
    Vue.prototype.$commTypeOptions = [{ label: '电话', key: 'TEL' }, { label: '拜访', key: 'VISIT' }, { label: '社交工具', key: 'SJ' }, { label: '邮件', key: 'MAIL' }, { label: '其他', key: 'OTHER' }]
    Vue.filter('$commTypeFilter', function(value) {
      const commTypeMap = {
        TEL: '电话',
        VISIT: '拜访',
        SJ: '社交工具',
        MAIL: '邮件',
        OTHER: '其他'
      }
      return commTypeMap[value]
    })

    Vue.prototype.$commGoalOptions = [{ label: '个人', key: 'GEREN' }, { label: '接洽', key: 'CONTACT' }, { label: '内容引入', key: 'CONTENT' }, { label: '内容输入', key: 'INPUT' }, { label: '商务交流', key: 'BUSINESS' }]
    Vue.filter('$commGoalFilter', function(value) {
      const commGoalMap = {
        GEREN: '个人',
        CONTACT: '接洽',
        CONTENT: '内容引入',
        INPUT: '内容输入',
        BUSINESS: '商务交流'
      }
      return commGoalMap[value]
    })

    Vue.prototype.$commProgressOptions = [{ label: '待完成', key: 'WAIT' }, { label: '已完成', key: 'FINISH' }]
    Vue.filter('$commProgressFilter', function(value) {
      const commProgressMap = {
        WAIT: '待完成',
        FINISH: '已完成'
      }
      return commProgressMap[value]
    })

    Vue.prototype.$commProgressOptions = [{ label: '一星', key: 'ONE' }, { label: '二星', key: 'TWO' }, { label: '三星', key: 'THREE' }, { label: '四星', key: 'FOUR' }, { label: '五星', key: 'FIVE' }]
    Vue.filter('$commDifficultyFilter', function(commDifficulty) {
      const commDifficultyMap = {
        ONE: '一星',
        TWO: '二星',
        THREE: '三星',
        FOUR: '四星',
        FIVE: '五星'
      }
      return commDifficultyMap[commDifficulty]
    })

    // 操作日志
    Vue.prototype.$opTypeOptions = [{ label: '供应商', key: 'SupplyInfo' }, { label: '供应商联系人', key: 'SupplyLinkMans' }, { label: '合同', key: 'SupplyContract' }, { label: '版权', key: 'Copyrights' }, { label: '授权', key: 'ContractRights' }, { label: '沟通', key: 'Communication' }]
    Vue.filter('$opTypeFilter', function(value) {
      const opTypeMap = {
        SupplyInfo: '供应商',
        SupplyLinkMans: '供应商联系人',
        SupplyContract: '合同',
        Copyrights: '版权',
        ContractRights: '授权',
        Communication: '沟通'
      }
      return opTypeMap[value]
    })

    Vue.prototype.$opActionOptions = [{ label: '添加', key: 'ADD' }, { label: '修改', key: 'EDIT' }, { label: '失效', key: 'INVALID' }, { label: '导入', key: 'IMPORT' }, { label: '删除', key: 'DELETE' }, { label: '混合', key: 'MIX' }, { label: '上线', key: 'ONLINE' }, { label: '下线', key: 'OFFLINE' }]
    Vue.filter('$opActionFilter', function(value) {
      const opActionMap = {
        ADD: '添加',
        EDIT: '修改',
        INVALID: '失效',
        IMPORT: '导入',
        DELETE: '删除',
        MIX: '混合',
        ONLINE: '上线',
        OFFLINE: '下线'
      }
      return opActionMap[value]
    })

    Vue.prototype.$upZindex = 999
  }
</script>

